package com.sniff.atp.constant.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @ProjectName: sniff-atp
 * @Package: com.sniff.atp.constant.config
 * @ClassName: MybatisPlusConfig
 * @Description: java类作用描述
 * @Author: zss
 * @CreateDate: 2023/8/29 20:16
 * @UpdateDate: 2023/8/29 20:16
 * @Version: 1.0
 */

@Configuration
@EnableTransactionManagement
@MapperScan({"com.sniff.atp.modules.test.*.mapper"})
public class MybatisPlusConfig {


//    @Bean
//    public MybatisPlusInterceptor mybatisPlusInterceptor (){
//        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
//        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
//        return interceptor;
//    }

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

//    @Bean
//    public GlobalConfig globalConfig(){
//        GlobalConfig globalConfig = new GlobalConfig();
//        globalConfig.setMetaObjectHandler(new MybatisPLusF)
//    }
}
